xen/arm: route_irq_to_guest: Check validity of the IRQ
authorJulien Grall <julien.grall@linaro.org>
Wed, 1 Apr 2015 16:21:43 +0000 (17:21 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 2 Apr 2015 09:42:35 +0000 (10:42 +0100)
commit86ce68f7bbf24269b9ebe4bd132a6f7d3455a6bf
tree80d5d67fbffa030c75bb0b5746eb07071b917056
parent95140d5a1126137e3c41318d0eb0a81e77780e4f
xen/arm: route_irq_to_guest: Check validity of the IRQ

Currently Xen only supports SPIs routing for guest, add a function
is_assignable_irq to check if we can assign a given IRQ to the guest.

Secondly, make sure the vIRQ is not the greater than the number of IRQs
configured in the vGIC and it's an SPI.

Thirdly, when the IRQ is already assigned to the domain, check the user
is not asking to use a different vIRQ than the one already bound.

Finally, desc->arch.type which contains the IRQ type (i.e level/edge) must
be correctly configured before. The misconfiguration can happen when:
    - the device has been blacklisted for the current platform
    - the IRQ has not been described in the device tree

Also, use XENLOG_G_ERR in the error message within the function as it will
be later called from a guest.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/irq.c
xen/include/asm-arm/irq.h